<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html>
<html>
<head>
<title>企业CRM管理平台V1.0</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"
	charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="/crmp/Public/css/bootstrap.min.css" rel="stylesheet">
<link href="/crmp/Public/css/mainstyle.css" rel="stylesheet">
<link rel="stylesheet" href="/crmp/Public/css/jquery.fancybox.min.css">
<link rel="stylesheet" href="/crmp/Public/css/tConfirm.css">
<script src="/crmp/Public/js/jquery-1.11.1.min.js"></script>
<script src="/crmp/Public/js/bootstrap.min.js"></script>
<script src="/crmp/Public/js/jquery.fancybox.js"></script>
<script src="/crmp/Public/js/tConfirm.js"></script>
<script type="text/javascript">
	//加载完成运行
	$(function() {
		$('.countc').click(function() {
			folderc();
		});
		//时钟
		$('#date').html(getdate());
		setInterval(function() {
			$('#clock').html(new Date().toLocaleTimeString());
		}, 1000);
		$('.dctsk').click(function() {
			$('#dctsk').css('display', 'none');
		});
	})
	
	//获取日期
	function getdate() {
		var mydate = new Date();
		var str = mydate.getFullYear() + "-";
		str += (mydate.getMonth() + 1) + "-";
		str += mydate.getDate();
		return str;
	}
	//点文件夹事件
	function folderc() {
		if (!($('#clientdemo').attr('class') == 'collapse')) {
			$('.countc').find('span').removeClass().addClass(
					'glyphicon glyphicon-folder-close');
		} else {
			$('.countc').find('span').removeClass().addClass(
					'glyphicon glyphicon-folder-open');
		}
	}
</script>

</head>
<body>
	<div class="container">
		<header class="navbar navbar-default">
			<nav class="collapse navbar-collapse ">
				<div class="navbar-header">
					<a class="navbar-brand orange" href="<?php echo U('Main/main');?>">企业CRM管理平台V1.0</a>
				</div>
				<ul class="nav navbar-nav navbar-left">
					<li class="gettime">
						<div style="color: #575757; text-align: center;">
							<span id="date">日期加载中</span>
							<br>
							<i class="fa fa-clock-o"></i>
							<span id="clock">时间加载中</span>
						</div>
					</li>
				</ul>
				<?php $id = session('uid'); $Rs = M('user')->find($id); ?>
				<ul class="nav navbar-nav navbar-right">
					<li>
						<a href="<?php echo U('PublicOperate/onlineUser');?>" class="orange"
							data-toggle="dialog" data-id="online" data-mask="true"
							data-width="600" data-height="300">
							在线
							<span class="badge">
								<?php $where['update_time']=array('gt',time()-600);echo M('user')->where($where)->count(); ?>
							</span>
						</a>
					</li>
					<li class="dropdown">
						<a href="#" style="width: 120px; text-align: center;"
							class="dropdown-toggle" data-toggle="dropdown">
							我的账户
							<span class="caret"></span>
						</a>
						<ul class="dropdown-menu menu" style="min-width: 100%">
							<li>
								<a href="#changePwd" data-toggle="modal">
									<span class="glyphicon glyphicon-lock"></span>
									修改密码
								</a>
							</li>
							<li>
								<a href="#changeUser" data-toggle="modal">
									<span class="glyphicon glyphicon-user"></span>
									我的资料
								</a>
							</li>
							<li class="divider"></li>
							<li>
								<a href="#logout" data-toggle="modal" class="red">
									<span class="glyphicon glyphicon-off"></span>
									注销登陆
								</a>
							</li>
						</ul>
					</li>
				</ul>
			</nav>
		</header>
	</div>
	<div class="container">
		<div class="row">
			<div class="col-xs-3 menu capacity">
				<div class="panel-group" id="aa">
					
					<div class="panel panel-info">
						<div class="panel-heading">
							<button class="btn btn-primary" data-parent="#aa"
								data-toggle="collapse" data-target="#bb">客户管理</button>
						</div>
						<div class="panel-collapse collapse in" id="bb">
							<div class="panel-body">
								<div class="list-group">
									<a id="custInfo" class="list-group-item btn btn-info"
										href="<?php echo U('CustInfo/custInfo');?>">
										<span class="glyphicon glyphicon-file"></span>
										客户信息
									</a>
									<a class="list-group-item btn btn-info"
										href="<?php echo U('CustGd/index');?>">
										<span class="glyphicon glyphicon-file"></span>
										跟单记录
									</a>
									<a class="list-group-item btn btn-info"
										href="<?php echo U('Hetong/index');?>">
										<span class="glyphicon glyphicon-file"></span>
										合同管理
									</a>
									<a class="list-group-item btn btn-info"
										href="<?php echo U('Shou/index');?>">
										<span class="glyphicon glyphicon-file"></span>
										收款记录
									</a>
									<a class="list-group-item btn btn-info" href="<?php echo U('Fu/index');?>">
										<span class="glyphicon glyphicon-file"></span>
										付款记录
									</a>
									<a class="list-group-item btn btn-info"
										href="<?php echo U('Custp/CustpInfo');?>">
										<span class="glyphicon glyphicon-file"></span>
										公共客户
									</a>
									 <a
										class="list-group-item btn btn-info"
										href="<?php echo U('Inform/index');?>">
										<span class="glyphicon glyphicon-file"></span>
										通知通告
									</a> 
									<a class="list-group-item btn btn-info countc"
										data-toggle="collapse" data-target="#clientdemo">
										<span class="glyphicon glyphicon-folder-open"></span>
										统计分析
									</a>
									<div id="clientdemo" class="collapse in">
										<div class="list-group">
											<a class="list-group-item btn btn-info"
												href="<?php echo U('CustInfo/custlfenxi');?>">
												<span class="glyphicon glyphicon-file"></span>
												客户来源
											</a>
											<a class="list-group-item btn btn-info"
												href="<?php echo U('CustInfo/gdjdfenxi');?>">
												<span class="glyphicon glyphicon-file"></span>
												跟踪进度
											</a>
											<a class="list-group-item btn btn-info"
												href="<?php echo U('CustInfo/niandufenxi');?>">
												<span class="glyphicon glyphicon-file"></span>
												增长趋势
											</a>

										</div>
									</div>
								</div>
							</div>
						</div>
					</div>
					
				</div>
			</div>
			<div id="inquiry" class="col-xs-9" style="font-size: 12px">
				
				<div class="col-md-6 tablediv">
					<form id="bianform"">
						<div class="panel panel-default ">
							<div class="panel-heading tablepanl-head">
								<span class="panel-title">
									<span class="glyphicon glyphicon-paperclip"></span>
									<b style="color: #5E5E5E">我的便签、记事本</b>
									<span>
										<button id="bian" type="button" class="btn btn-xs btn-info">保存</button>
									</span>
								</span>
							</div>
							<div class="bian-tableheight">
								<textarea
									style="height: 100%; width: 100%; border: 0px; line-height: 150%"
									name="bian"><?php echo ($Rs['bian']); ?></textarea>
							</div>
						</div>
					</form>
					<script type="text/javascript">
				$("#bian").click(function() {
					$.post('<?php echo U('PublicOperate/bian');?>',$('#bianform').serialize(),function(zc){
						if(zc.zt){
							$.tConfirm.open({body:zc.mes,type:'success',onOk:function(){
								location.href=zc.url;
				            }});
						}else{
							$.tConfirm.open({body:zc.mes,type:'warning',onOk:function(){
				            }});
						}						
					});
					});
				</script>
				</div>
				
				<!--//-->
				
				<div class="col-md-6 tablediv">
					<div class="panel panel-default">
						<div class="panel-heading tablepanl-head">
							<span class="panel-title">
								<span class="glyphicon glyphicon-tasks">&nbsp;</span>
								<b style="color: #5E5E5E">我的任务</b>
								<a href="<?php echo U('RemindDetail/myTask');?>"
									class="btn btn-xs btn-info" style="color: white;">详细</a>
							</span>
						</div>
						<div class="tableheight">
							<table
								class="table table-bordered table-hover table-condensed tablenowrap">
								<tr>
									<th>开始时间</th>
									<th>结束时间</th>
									<th>任务标题</th>
									<th>发布人</th>
									<th>发布时间</th>
								</tr>
								<?php $list=M('task')->where(array('juid'=>array('like','%'.session(uid).'%')))->order("id
								desc")->limit(5)->select(); ?>
								<?php if(is_array($list)): $i = 0; $__LIST__ = $list;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$v): $mod = ($i % 2 );++$i;?><tr>
									<td><?php echo (substr($v["kssj"],5,5)); ?></td>
									<td><?php echo (substr($v["jssj"],5,5)); ?></td>
									<td><?php echo (msubstr($v["title"],0,7)); ?></td>
									<td><?php echo ($v["uname"]); ?></td>
									<td><?php echo (substr($v["addtime"],5,5)); ?></td>
								</tr><?php endforeach; endif; else: echo "" ;endif; ?>
							</table>
						</div>
					</div>
				</div>
				
				<!--//-->
				
				<div class="col-md-6 tablediv">
					<div class="panel panel-default">
						<div class="panel-heading tablepanl-head">
							<span class="panel-title">
								<span class="glyphicon glyphicon-envelope"></span>
								&nbsp;
								<b style="color: #5E5E5E">通知公告</b>
								<a href="<?php echo U('RemindDetail/inform');?>"
									class="btn btn-xs btn-info" style="color: white;">详细</a>
							</span>
						</div>
						<div class="tableheight">
							<table
								class="table table-bordered table-striped table-hover table-condensed tablenowrap">
								<tr>
									<th>通知标题</th>
									<th>截止日期</th>
									<th>发布人</th>
									<th>发布时间</th>
								</tr>
								<?php $list=M('info')->where(array('juid'=>array('like','%'.session(uid).'%')))->order("id
								desc")->limit(5)->select(); ?>
								<?php if(is_array($list)): $i = 0; $__LIST__ = $list;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$v): $mod = ($i % 2 );++$i;?><tr>
									<td><?php echo (msubstr($v["title"],0,7)); ?></td>
									<td><?php echo (substr($v["jzrq"],5,5)); ?></td>
									<td><?php echo ($v["uname"]); ?></td>
									<td><?php echo (substr($v["addtime"],5,5)); ?></td>
								</tr><?php endforeach; endif; else: echo "" ;endif; ?>
							</table>
						</div>
					</div>
				</div>
				
				<!--//-->
				
<div class="col-md-6 tablediv">
	<div class="panel panel-default">
		<div class="panel-heading tablepanl-head">
			<span class="panel-title">
			<span class="glyphicon glyphicon-plane"></span>&nbsp;
				<b style="color: #5E5E5E">员工去向</b>
				<a href="<?php echo U('RemindDetail/gos');?>" class="btn btn-xs btn-info" style="color: white;">详细</a>
			</span>
		</div>
		<div class="tableheight">
			<table class="table table-bordered table-condensed tablenowrap table-hover" >
				<tr>
					<th>开始时间</th>
					<th>结束时间</th>
					<th>去向说明</th>
					<th>外出人</th>
					<th>所在部门</th>
				</tr>
				<?php $list=M('mygo')->order("id desc")->limit(5)->select(); ?>
				<?php if(is_array($list)): $i = 0; $__LIST__ = $list;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$v): $mod = ($i % 2 );++$i;?><tr>
					<td><?php echo (substr($v["kssj"],5,5)); ?></td>
					<td><?php echo (substr($v["jssj"],5,5)); ?></td>
					<td><?php echo (msubstr($v["title"],0,7)); ?></td>
					<td><?php echo (msubstr($v["uname"],0,4)); ?></td>
					<td><?php echo (msubstr($v["bumen"],0,6)); ?></td>
				</tr><?php endforeach; endif; else: echo "" ;endif; ?>
			</table>
		</div>
	</div>
</div>

			</div>
		</div>
	</div>
	<div class="container">
		<footer id="bjui-footer" class="footer">
			<span class="glyphicon glyphicon-map-marker"></span>
			您好！<?php echo (session('depname')); ?> <?php echo (session('posname')); ?>
			<?php echo (session('truename')); ?> (<?php echo (session('username')); ?>)
			您的IP:<?php echo (session('loginip')); ?> 登录时间:<?php echo (session('logintime')); ?>

			<span class="right">
				<a href="">XXXX@科技网络有限公司</a>
				服务热线：000-000-0000
			</span>
		</footer>
	</div>
	<div id="changePwd" class="modal">
		<div class="modal-dialog" style="width: 450px;">
			<div class="modal-content">
				<div class="modal-header">
					<h4 class="modal-title">
						<span class="glyphicon glyphicon-th-list">&nbsp;</span>
						修改密码
					</h4>
				</div>
				<form class="form-horizontal" id='cpasswordform'>
					<div class="modal-body">
						<div class="form-group">
							<label for="aa" class="control-label col-xs-3">旧&nbsp;&nbsp;密&nbsp;&nbsp;码:</label>
							<div class="col-xs-8">
								<input id="aa" class="form-control" type="password"
									required="required" placeholder="旧密码" name="oldpassword" />
							</div>
						</div>
						<div class="form-group">
							<label for="bb" class="control-label col-xs-3">新&nbsp;&nbsp;密&nbsp;&nbsp;码:</label>
							<div class="col-xs-8">
								<input id="bb" class="form-control" type="password"
									required="required" placeholder="新密码" name="password" />
							</div>
						</div>
						<div class="form-group">
							<label for="bb" class="control-label col-xs-3">确认密码:</label>
							<div class="col-xs-8">
								<input id="bb" class="form-control" type="password"
									required="required" placeholder="确认密码" name="repassword" />
							</div>
						</div>
					</div>
					<div class="modal-footer" style="padding-right: 60px">
						<button id="cpassword" class="btn btn-primary" type="button">修改</button>
						<button class="btn btn-default" data-dismiss="modal">取消</button>
					</div>
				</form>
				<script type="text/javascript">
				$("#cpassword").click(function() {
					$.post('<?php echo U('PublicOperate/changePwd');?>',$('#cpasswordform').serialize(),function(zc){
						if(zc.zt){
							$.tConfirm.open({body:zc.mes,type:'success',onOk:function(){
								location.href=zc.url;
				            }});
						}else{
							$.tConfirm.open({body:zc.mes,type:'warning',onOk:function(){
				            }});
						}						
					});
					});
				</script>
			</div>
		</div>
	</div>
	<div id="logout" class="modal">
		<div class="modal-dialog">
			<div class="modal-content">
				<div class="modal-header">
					<button class="close" data-dismiss="modal">&times;</button>
					<h4 class="modal-title">
						<span class="glyphicon glyphicon-off">&nbsp;</span>
						确定退出登录
					</h4>
				</div>
				<div class="modal-body">你确定要退出登录吗？</div>
				<div class="modal-footer">
					<a href="<?php echo U('Index/logout');?>" class="btn btn-primary">确定</a>
					<button class="btn btn-default" data-dismiss="modal">取消</button>
				</div>
			</div>
		</div>
	</div>
	<div id="changeUser" class="modal">
		<div class="modal-dialog" style="width: 450px;">
			<div class="modal-content">
				<div class="modal-header">
					<h4 class="modal-title">
						<span class="glyphicon glyphicon-th-list">&nbsp;</span>
						个人资料
					</h4>
				</div>
				<form class="form-horizontal" id="cuserform"
					action="<?php echo U('PublicOperate/changeUser');?>">
					<div class="modal-body">
						<input type="hidden" name="id" value="<?php echo ($id); ?>">
						<table class="table table-condensed table-hover">
							<tr>
								<td>
									<label for="j_title" class="control-label x85">真实姓名：</label>
									<input type="text" data-rule="required" size="25"
										name="truename" id="j_truename" value="<?php echo ($Rs['truename']); ?>"
										disabled>
								</td>
							</tr>
							<tr>
								<td>
									<label for="j_title" class="control-label x85">性别：</label>
									<select name="sex" data-toggle="selectpicker"
										data-rule="required">
										<?php if($Rs['sex'] == '男'): ?><option value="男" selected>男</option>
										<?php else: ?>
										<option value="女" selected>女</option><?php endif; ?>
										<option value="男">男</option>
										<option value="女">女</option>
									</select>
								</td>
							</tr>
							<tr>
								<td>
									<label for="j_title" class="control-label x85">固定电话：</label>
									<input type="text" data-rule="required" size="25" name="tel"
										id="j_tel" value="<?php echo ($Rs['tel']); ?>">
								</td>
							</tr>
							<tr>
								<td>
									<label for="j_title" class="control-label x85">移动电话：</label>
									<input type="text" data-rule="required" size="25" name="phone"
										id="j_phone" value="<?php echo ($Rs['phone']); ?>">
								</td>
							</tr>
							<tr>
								<td>
									<label for="j_title" class="control-label x85">电子邮箱：</label>
									<input type="text" data-rule="required" size="25" name="email"
										id="j_email" value="<?php echo ($Rs['email']); ?>">
								</td>
							</tr>
							<tr>
								<td>
									<label for="j_title" class="control-label x85">qq：</label>
									<input type="text" data-rule="required" size="25" name="qq"
										id="j_qq" value="<?php echo ($Rs['qq']); ?>">
								</td>
							</tr>
							<tr>
								<td>
									<label for="j_title" class="control-label x85">内线/短号：</label>
									<input type="text" size="25" name="neixian"
										value="<?php echo ($Rs['neixian']); ?>">
								</td>
							</tr>
						</table>
					</div>
					<div class="modal-footer" style="padding-right: 60px">
						<button id="cuser" class="btn btn-primary" type="button">保存</button>
						<button class="btn btn-default" data-dismiss="modal">取消</button>
					</div>
				</form>
					<script type="text/javascript">
				$("#cuser").click(function() {
					$.post('<?php echo U('PublicOperate/changeUser');?>',$('#cuserform').serialize(),function(zc){
						if(zc.zt){
							$.tConfirm.open({body:zc.mes,type:'success',onOk:function(){
								location.href=zc.url;
				            }});
						}else{
							$.tConfirm.open({body:zc.mes,type:'warning',onOk:function(){
				            }});
						}						
					});
					});
				</script>
			</div>
		</div>
	</div>
</body>
</html>